package com.controller
{
	

	import com.service.InvoiceSplitDetails;
	
	import mx.collections.ArrayCollection;
	import mx.controls.Alert;
	import mx.managers.CursorManager;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	
	public class SplitTableController extends AbstractController
	{
		import com.model.Model;
		[Inject]
		public var invoiceSplitDetails:InvoiceSplitDetails;
		public function SplitTableController()
		{
			super();
		}
		
		
		[EventHandler(event="SplitTableEvent.GET_ALL")]
		public function getAllSplitTableDetails():void{
			sh.executeServiceCall(invoiceSplitDetails.getAllSplitDetails(model.currentDatabase), getAllSplitTableResult, handleFault );
		}
		
		private function getAllSplitTableResult(event:ResultEvent):void
		{
			model.SplitTableMasterDetails=event.result as ArrayCollection;
			model.SplitTableMasterDetails.refresh();
			CursorManager.removeBusyCursor();
		}
		private function handleFault(event:FaultEvent):void
		{
			//Alert.show( 'v '+event.fault.name, "Error" );
			CursorManager.removeBusyCursor();
		}
		
		
	}
}